from django.db.models import Q
from rest_framework import serializers

from motion.models import InvolverMotionPath
from report.models import InvolverInfo


class InvolverMotionPathSerializer(serializers.ModelSerializer):
    begin_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=True)
    end_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=True)
    create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
    modify_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)

    class Meta:
        model = InvolverMotionPath
        fields = "__all__"


class InvolverMotionPathTimeRangeSerializer(serializers.ModelSerializer):
    begin_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=True)
    end_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=True)
    create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
    modify_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)

    class Meta:
        model = InvolverMotionPath
        fields = "__all__"
